From 921b5ca3e9ca3d1e06fe189b4775aae7dcc484bf Mon Sep 17 00:00:00 2001 From: Stevan Earl Date: Wed, 9 Sep 2026 20:25:17 -0700 Subject: [PATCH] fix: complete Problem #74 aggression flag loading --- conversion/load_aggressions.m4 | 79 ++++++++++++++++------------------ 1 file changed, 36 insertions(+), 43 deletions(-) diff --git a/conversion/load_aggressions.m4 b/conversion/load_aggressions.m4 index a39dd98..b6dfd5b 100644 --- a/conversion/load_aggressions.m4 +++ b/conversion/load_aggressions.m4 @@ -132,85 +132,78 @@ BEGIN ,extractedby) SELECT CURRVAL('events_eid_seq') + -- Problem #74 , CASE -- decided - WHEN this_ae.ae_decided_flag IS NULL THEN - '0' + WHEN this_ae.ae_decided_flag = '' THEN + FALSE WHEN this_ae.ae_decided_flag = 'X' THEN - '1' + TRUE ELSE - 'Invalid' -- Blow up with an typecasting error + this_ae.ae_decided_flag::boolean -- Blow up with a typecasting error END , CASE -- multiaggressors - WHEN this_ae.ae_multiple_aggressor_flag IS NULL THEN - '0' + WHEN this_ae.ae_multiple_aggressor_flag = '' THEN + FALSE WHEN this_ae.ae_multiple_aggressor_flag = 'X' THEN - '1' + TRUE ELSE - 'Invalid' -- Blow up with an typecasting error + this_ae.ae_multiple_aggressor_flag::boolean -- Blow up with a typecasting error END , CASE -- multirecipients - WHEN this_ae.ae_multiple_recipient_flag IS NULL THEN - '0' + WHEN this_ae.ae_multiple_recipient_flag = '' THEN + FALSE WHEN this_ae.ae_multiple_recipient_flag = 'X' THEN - '1' + TRUE ELSE - 'Invalid' -- Blow up with an typecasting error + this_ae.ae_multiple_recipient_flag::boolean -- Blow up with a typecasting error END , CASE -- badobs - WHEN this_ae.ae_bad_observation_flag IS NULL THEN + WHEN this_ae.ae_bad_observation_flag = '' THEN FALSE - WHEN this_ae.ae_bad_observeation_flag = 'X' THEN + WHEN this_ae.ae_bad_observation_flag = 'X' THEN TRUE ELSE - 'Invalid' -- Blow up with an typecasting error + this_ae.ae_bad_observation_flag::boolean -- Blow up with a typecasting error END , CASE -- bristle - WHEN this_ae.ae_bristle_flag IS NULL THEN - '0' + WHEN this_ae.ae_bristle_flag = '' THEN + FALSE WHEN this_ae.ae_bristle_flag = 'X' THEN - '1' + TRUE ELSE - 'Invalid' -- Blow up with an typecasting error + this_ae.ae_bristle_flag::boolean -- Blow up with a typecasting error END , CASE -- display - WHEN this_ae.ae_display_flag IS NULL THEN - '0' + WHEN this_ae.ae_display_flag = '' THEN + FALSE WHEN this_ae.ae_display_flag = 'X' THEN - '1' + TRUE ELSE - 'Invalid' -- Blow up with an typecasting error + this_ae.ae_display_flag::boolean -- Blow up with a typecasting error END , CASE -- chase - WHEN this_ae.ae_chase_flag IS NULL THEN - '0' + WHEN this_ae.ae_chase_flag = '' THEN + FALSE WHEN this_ae.ae_chase_flag = 'X' THEN - '1' - ELSE - 'Invalid' -- Blow up with an typecasting error - END - , CASE -- contact - WHEN this_ae.ae_contact_flag IS NULL THEN - '0' - WHEN this_ae.ae_contact_flag = 'X' THEN - '1' + TRUE ELSE - 'Invalid' -- Blow up with an typecasting error + this_ae.ae_chase_flag::boolean -- Blow up with a typecasting error END , CASE -- contact - WHEN this_ae.ae_contact_flag IS NULL THEN - '0' + WHEN this_ae.ae_contact_flag = '' THEN + FALSE WHEN this_ae.ae_contact_flag = 'X' THEN - '1' + TRUE ELSE - 'Invalid' -- Blow up with an typecasting error + this_ae.ae_contact_flag::boolean -- Blow up with a typecasting error END , CASE -- vocal - WHEN this_ae.ae_vocal_flag IS NULL THEN - '0' + WHEN this_ae.ae_vocal_flag = '' THEN + FALSE WHEN this_ae.ae_vocal_flag = 'X' THEN - '1' + TRUE ELSE - 'Invalid' -- Blow up with an typecasting error + this_ae.ae_vocal_flag::boolean -- Blow up with a typecasting error END , this_ae.ae_fight_category , this_ae.ae_aggressor_behavior -- 2.34.1